module entitas.utils{
    export class UnorderSet {
        _map : {};
        length : number;
        insert(key ,value ){
            if(this._map[key] == null){

                this.length += 1
                this._map[key] = value
            }
        }

        remove(key ){
            if(this._map[key] != null){
                this.length -= 1
                this._map[key] = null
            }
        }

        size() : number{
            return this.length
        }

        has(key){
            return this._map[key] == null
        }

        foreach(f) {
            for (let k in this._map) {
                f(this._map[k]);
            }
        }

        clear(){
            this._map = {}
        }
    }
}